﻿@using Model.Admin;
@using Xproject.Util;
@{
    string Domain = CommonHelper.GetAppSettings("Domin");
    Layout = "~/Views/Shared/_JSlayout.cshtml";
}
@model AdminUser
<div class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <form class="form-horizontal m-t" id="userinfo" action="~/UserInfo/UserInfoEdit" method="post">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">姓名：</label>
                                <div class="col-sm-8">
                                    <label class="control-label">@Model.UserName</label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">UserCode：</label>
                                <div class="col-sm-8">
                                    <label class="control-label">@Model.UserCode</label>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">E-mail：</label>
                                <div class="col-sm-8">
                                    <input id="Email" type="Email" value="@Model.Email" class="form-control" name="email" required aria-required="true">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">手机：</label>
                                <div class="col-sm-8">
                                    <input id="Mobile" type="number" class="form-control" name="Mobile" required value="@Model.Mobile">
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-3">
                                    <input type="hidden" name="ID" value="@Model.ID" />
                                    <button class="btn btn-primary" type="submit">修改</button>
                                </div>                            
                            </div>
                        </form>
                    </div>
                </div>
                </div>
            </div>
    </div>
 </div>
    <script type="text/javascript">
     
        $(document).ready(function () {
            var optionsNew = {
                beforeSubmit: function () {
                    //layer.open({ type: 2, time: 2 });
                    layer.load(1, { shade: [0.1, '#000'], time: 2000 });
                },
                success: function (data) {
                    if (data.Success == true) {
                        layer.alert('编辑成功', { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                        // layer.open({ content: '新增成功', style: 'color:black; ', time: 2 });
                        // window.location.href = "~/Home/Index" + "?id=" + 10000 * Math.random();
                    } else {
                        layer.alert(data.Data, { icon: 1, skin: 'layer-ext-moon', time: 2 });
                        //layer.open({ content: data.Data, style: 'color:black; ', time: 2 });
                    }
                },
                error: function () {
                    alert(JSON.stringify(data));
                },
                type: "post",
                clearForm: false,
                timeout: 100000
            };

            $("#userinfo").submit(function () {
                $("#userinfo").ajaxSubmit(optionsNew);// type="button"
                return false;
            });
        });


    </script>
